<!--
  - Copyright (C) 2018-2019
  - All rights reserved, Designed By www.joolun.com
-->
<template>
  <div class="news-home">
    <div v-for="(news, index) in objData" :key="index" class="news-div">
      <a v-if="index === 0" target="_blank" :href="news.url">
        <div class="news-main">
          <div class="news-content">
            <img class="material-img" :src="news.thumbUrl" width="280px" height="120px" />
            <div class="news-content-title">
              <span>{{ news.title }}</span>
            </div>
          </div>
        </div>
      </a>
      <a v-if="index > 0" target="_blank" :href="news.url">
        <div class="news-main-item">
          <div class="news-content-item">
            <div class="news-content-item-title">{{ news.title }}</div>
            <div class="news-content-item-img">
              <img class="material-img" :src="news.thumbUrl" height="100%" />
            </div>
          </div>
        </div>
      </a>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'WxNews',
    props: {
      objData: {
        type: Array
      }
    }
  }
</script>

<style lang="scss" scoped>
  .news-home {
    width: 100%;
    margin: auto;
    background-color: #fff;
  }

  .news-main {
    width: 100%;
    margin: auto;
  }

  .news-content {
    position: relative;
    width: 100%;
    background-color: #acadae;
  }

  .news-content-title {
    position: absolute;
    bottom: 0;
    left: 0;
    display: inline-block;
    box-sizing: unset !important;
    width: 98%;
    padding: 1%;
    color: #fff;
    font-size: 12px;
    white-space: normal;
    background-color: black;
    opacity: 0.65;
  }

  .news-main-item {
    padding: 5px 0;
    background-color: #fff;
    border-top: 1px solid #eaeaea;
  }

  .news-content-item {
    position: relative;
  }

  .news-content-item-title {
    display: inline-block;
    width: 70%;
    margin-left: 1%;
    font-size: 10px;
    white-space: normal;
  }

  .news-content-item-img {
    display: inline-block;
    width: 25%;
    margin-right: 1%;
    background-color: #acadae;
  }

  .material-img {
    width: 100%;
  }
</style>
